using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Util;
using Android.Views;
using Android.Widget;

namespace TMM.Controls
{
    public class NotificationsButtonView : RelativeLayout
    {
        public int NoNotifications { get { return nrNotifications; } }
        TextView notificationsTextView = null;

        private int nrNotifications = 0;

        public NotificationsButtonView(Context context, IAttributeSet attrs) :
            base(context, attrs)
        {
            Initialize();
        }

        private void Initialize()
        {
            var view = Inflate(Context, Resource.Layout.NotificationsButtonView, null);
            AddView(view);

            notificationsTextView = view.FindViewById<TextView>(Resource.Id.notificationsTextView);
        }

        public void SetNumber(int nr)
        {
            nrNotifications = nr;
            if (nr <= 0)
            {
                notificationsTextView.Visibility = ViewStates.Gone;
                this.Enabled = false;
            }
            else
            {
                notificationsTextView.Visibility = ViewStates.Visible;
                notificationsTextView.Text = nr.ToString();
                this.Enabled = true;
            }
        }
    }
}